package org.csu.pet_store_2.Controller;

import org.csu.pet_store_2.Common.CommonResponse;
import org.csu.pet_store_2.Domain.Item;
import org.csu.pet_store_2.persistence.CartMapper;
import org.csu.pet_store_2.persistence.ItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Transactional
public class ItemController {

   @Autowired
   private ItemMapper itemMapper;

   @GetMapping("/item")
   public CommonResponse<Item> getItemByItemId(@RequestParam("id")String itemId){
       Item item=itemMapper.getItemByItemid(itemId);
       return CommonResponse.creatForSuccess(item);

   }

}

